<%@ page contentType="text/html;charset=UTF-8"%> 
<%@ include file="/taglibs.jsp" %>

<stripes:layout-render name="/layout/standard.jsp" title="主页">
    <stripes:layout-component name="contents">

	    <h1>广告列表</h1>
        <stripes:useActionBean id="adList" event="adList" beanclass="com.ehuoyun.ecstore.action.AdvertisementListActionBean"/>
        <stripes:form action="/AdvertisementList.action">
            <stripes:errors/>

            <table class="display">
                <tr>
                    <th>ID</th>
                    <th>名称：</th>
                    <th>地址：</th>
                    <th>时间：</th>
                    <th>图片：</th>
                    <th></th>
                </tr>
                <c:forEach items="${adList.allAdvertisements}" var="ad" varStatus="rowstat">
                    <tr class="${rowstat.count mod 2 == 0 ? "even" : "odd"}">
                        <td>${ad.id}</td>
                        <td>${ad.name}</td>
                        <td>${ad.location}</td>
                        <td><fmt:formatDate value="${ad.createdDate}" dateStyle="medium"/></td>
                        <td>
                        	<c:if test="${ad.image != null}">
	                        	<a target="_blank" href="/AdImage.action?id=${ad.id}">
	                        	 <img alt="${ad.location}" src="/AdImage.action?id=${ad.id}"/></a>
                        	</c:if>
                        </td>
                        <td>
                            <stripes:link href="/Advertisement.action" event="view">
                            	查看
                                <stripes:param name="ad.id" value="${ad.id}"/>
                            </stripes:link>
                            <stripes:link href="/Advertisement.action" event="edit">
                            	修改
                                <stripes:param name="ad.id" value="${ad.id}"/>
                            </stripes:link>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </stripes:form>
        
    </stripes:layout-component>
</stripes:layout-render>
